<%-- 
    Document   : sysadminhmoe
    Created on : 22/07/2011, 9:57:50 AM
    Author     : Tom McNair - S41758984
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<style>

    #syshome-title {         
        text-align: center; 
        
    }    
    #syshome-poll-details {
        padding-bottom: 40px;
    }    
    #syshome-numuser{
        padding-left: 80px;
    }    
    #syshome-users{
        padding-bottom:40px;
    }   
    #syshome-polladmindate{
        padding-bottom: 50px;
    }
    
    #expiry { color: red; font-weight:bold; }
    #text {
        border-style: none;
        background-color: white;
        text-align: center;
    }
    .sysadmintable {
    font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
    width:80%;
    border:1px solid #009933;
    text-align:center;
    }
    .sysadmintable td, .sysadmintable th .sysadmintable tr {
    font-size:1em;    
    border:1px solid #009933;
    padding:3px 7px 2px 17px;
    }
    .sysadmintable th {
    font-size:1.1em;
    text-align:center;
    padding-top:5px;
    padding-bottom:4px;
    background-color:#008833;
    color:#ffffff;
    }

    #types {
        padding-left: 520px;
        padding-bottom: 20px;
    }
    #print{
        float:right;
        padding-right:148px;
        padding-bottom:20px;
    }
    
    #exp-td-t {
        background-color:red;
        color:white;
    }

</style>

<script language="Javascript" type="text/javascript">
    function init() {
        document.getElementById("graphic").hidden = true;
        document.getElementById("original").hidden = false;
    }
    window.onload = init; 
    
    function printFunction(){
        document.getElementById("upper_container").hidden = true;
        document.getElementById("homeFooter").hidden = true;
        document.getElementById("types").hidden = true;
        document.getElementById("pButton").hidden = true;
        window.print();
        document.getElementById("upper_container").hidden = false;
        document.getElementById("homeFooter").hidden = false;
        document.getElementById("types").hidden = false;
        document.getElementById("pButton").hidden = false;
        return false;
    }
    
    function switchType1() {
        document.getElementById("graphic").hidden = false;
        document.getElementById("original").hidden = true;
    }
    
    function switchType2() {
        document.getElementById("graphic").hidden = true;
        document.getElementById("original").hidden = false;   
    }
    
</script>



<%@ include file="../header.jsp" %>
<link rel="stylesheet" type="text/css" href="../style.css"/>
<div id="content-container">

    <div id="content">
        <!-- Content goes here -->
        <div id ="syshome-title">
             <h3 onLoad="load()">System Administrator Utilisation Reports </h3>
        </div>    
        <div id="types">
            <input type="button" id="switch-1" value="Graphical" onclick="switchType1()"/>
            <input type="button" id="switch-2" value="Plain" onclick="switchType2()"/>
        </div>
        <div id = "syshome-numuser">
            <c:choose>   
                <c:when test="${not empty sysReport}">
                    <span id="graphic">
                        <div id = "syshome-polladmindate">  
                            <table class="sysadmintable">
                                <tr>
                                    <th>Poll Administrator id</th>
                                    <th>Expiry date</th> 
                                    <th>Expiry within 30 days</th> 
                                </tr>

                                <c:forEach items="${admin}" var="admin">     
                                    <tr>
                                        <td>${admin.getID()}</td>
                                        <td>${admin.getExpiryDate()}</td>
                                        <c:if test="${admin.expiresSoon() == 'true'}">
                                            <td id="exp-td-t">${admin.expiresSoon()}</td>
                                        </c:if>
                                        <c:if test="${admin.expiresSoon() == 'false'}">
                                            <td>${admin.expiresSoon()}</td>
                                        </c:if>
                                    </tr>
                                </c:forEach>
        
                            </table>
                        </div></br>
                        ${userGraph} </br>
                        ${pollGraph}
                    </span>
                    
                    <span id="original">
                        <div id = "syshome-polladmindate">  
                            <table class="sysadmintable">
                                <tr>
                                    <th>Poll Administrator id</th>
                                    <th>Expiry date</th> 
                                    <th>Expiry within 30 days</th> 
                                </tr>
                                <c:forEach items="${admin}" var="admin">     
                                    <tr>
                                        <td>${admin.getID()}</td>
                                        <td>${admin.getExpiryDate()}</td>
                                        <c:if test="${admin.expiresSoon() == 'true'}">
                                            <td id="exp-td-t">${admin.expiresSoon()}</td>
                                        </c:if>
                                        <c:if test="${admin.expiresSoon() == 'false'}">
                                            <td>${admin.expiresSoon()}</td>
                                        </c:if>
                                    </tr>
                                </c:forEach>
                            </table>
                        </div>
                        
                        <div id="syshome-users">      
                            <table class="sysadmintable">

                                <tr>
                                    <th>Type of User</th>
                                    <th>Number of Users in the system</th> 
                                </tr>

                                <tr><td>Poll User</td><td>${sysReport.getUserWeb()}</td></tr>
                                <tr><td>Poll Master</td><td>${sysReport.getUserMaster()}</td></tr>
                                <tr><td>Poll Creator</td><td>${sysReport.getUserCreator()}</td></tr>
                                <tr><td>Poll Administrator</td><td>${sysReport.getUserAdmin()}</td></tr>
                                <tr><td>System Administrator</td><td>${sysReport.getUserSysAdmin()}</td></tr>
                            </table>
                        </div>
                        <br/>
                        
                        <div id = "syshome-poll-details" >

                            <table class="sysadmintable">
                                <tr>
                                    <th>Poll Pending</th>
                                    <th>Poll Open</th>
                                    <th>Poll Complete</th>
                                    <th>Poll Total</th>
                                </tr>
                                <tr><td>${sysReport.getPollPending()}</td><td>${sysReport.getPollOpen()}</td><td>${sysReport.getPollComplete()}</td><td>${sysReport.getPollTotal()}</td></tr>
                            </table>
                        </div>
                    </span>
                    </c:when>
                    <c:otherwise>
                    <p>No items for users!</p>
                    <p>No items for Poll!</p>
                    <p>No items for Administrator!</p>
                </c:otherwise>
            </c:choose>
        </div>
        <div id="print">
            <input type="submit" id="pButton" onClick="printFunction()" value="Print"/></input>
        </div>
    </div>
</div>		

<span id="homeFooter"><%@ include file="../footer.jsp" %></span>
